1. Field of the Invention
This invention is related to the field of processors and, more particularly, to performing data speculation in a processor.
2. Description of the Related Art
Superscalar processors achieve high performance by executing multiple instructions concurrently and by using the shortest possible clock cycle consistent with their design. However, data and control flow dependencies between instructions may limit how many instructions may be issued at any given time. As a result, some processors support speculative execution in order to achieve additional performance gains.
One type of speculation is control flow speculation. Control flow speculation predicts the direction in which program control will proceed. For example, branch prediction may be used to predict whether a branch will be taken. Many types of branch prediction are available, ranging from methods that simply make the same prediction each time to those that maintain sophisticated histories of the previous branches in the program in order to make a history-based prediction. Branch prediction may be facilitated through hardware optimizations, compiler optimizations, or both. Based on the prediction provided by the branch prediction mechanism, instructions may be speculatively fetched and executed. When the branch instruction is finally evaluated, the branch prediction can be verified. If the prediction was incorrect, any instructions that were speculatively executed based on the incorrect predication may be quashed.
Another type of speculation is data speculation, which predicts data values. Proposed types of data speculation include speculatively generating addresses for memory operations and speculatively generating data values for use in computational operations. As with control speculation, the underlying conditions used to speculatively generate a value are eventually evaluated, allowing the speculation to be verified or undone.
Since speculation allows execution to proceed without waiting for a speculative condition to be known, significant performance gains may be achieved if the performance gained from correct speculations exceeds the performance lost to incorrect speculations. Decreasing the performance penalties due to incorrect speculations is therefore desirable.